﻿using System;
using System.Diagnostics;
using System.Runtime.Serialization;
using Uploaders;

namespace Commands.Settings
{
    [DataContract]
    public class SharingServiceSettings : ServiceSettings
    {
        [DataMember]
        public string Name { get; set; }
    }

    [DataContract]
    public class FileSharingServicesSettings
    {
        public ServiceSettings GetSettingsByType(SharingServices serviceType)
        {
            Debug.Assert(Enum.GetValues(typeof(SharingServices)).Length == 8);

            var sharingServiceTypeName = serviceType.ToString();

            var settingsProperty = 
                typeof(FileSharingServicesSettings).GetProperty(sharingServiceTypeName);

            if (settingsProperty == null)
                throw new NotImplementedException(
                    string.Format("No settings for {0} service type", sharingServiceTypeName));

            return settingsProperty.GetValue(this, null) as ServiceSettings;
        }

        [DataMember]
        public string DefaultServiceName { get; set; }

        [DataMember]
        public ServiceSettings Gett { get; set; }

        [DataMember]
        public ServiceSettings YandexDisc { get; set; }

        [DataMember]
        public ServiceSettings SugarSync { get; set; }

        [DataMember]
        public ServiceSettings MediaFire { get; set; }

        [DataMember]
        public ServiceSettings Croco { get; set; }

        [DataMember]
        public ServiceSettings SlingFile { get; set; }

        [DataMember]
        public ServiceSettings FileCloud { get; set; }

        [DataMember]
        public ServiceSettings UploadedNet { get; set; }
        
    }
}
